"use strict"

/**
 * 南京社会代理采购网爬虫
 *  
 */

var Base = require("./base");
var nj_spider = new Base();
nj_spider.name = "南京社会代理采购网";

nj_spider.getPageUrl = function (pg) {
    var url = "http://www.njgp.gov.cn/cgxx/cggg/shdljg/";
    if (pg != 1) {
        url = "http://www.njgp.gov.cn/cgxx/cggg/shdljg/index_" + pg + ".html";
    }
    return url;
};

nj_spider.getItems = function ($) {
    var items = [];
    $(".R_cont_detail ul li a").each(function (index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.text().substring(30);
        e.url = e.attr("href").substring(1);
        item.url = "http://www.njgp.gov.cn/cgxx/cggg/shdljg" + e.url;
        item.source = nj_spider.name;
        items.push(item);
    });
    return items;
};

exports = module.exports = nj_spider;